using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WMVConvert.Metadata;
using System.Drawing;
using System.Runtime.InteropServices;

namespace WMVConvert.Tests.Metadata
{
	[TestClass]
	public class WMPictureFixture
	{
		[TestMethod]
		[DeploymentItem("Test.wmv")]
		[DeploymentItem("Test.jpg")]
		public void TestPicture()
		{
			using (Editor editor = new Editor(Helper.PrepareceDeploymentItem("Test.wmv","TestPicture")))
			{
				PictureType picType = PictureType.Media;
				const int pointerSize = sizeof(int);
				using (WMPicture picture = new WMPicture(picType, Bitmap.FromFile(Helper.PrepareceDeploymentItem("Test.jpg", "TestPicture"))))
				{
					IntPtr data = picture.ValueData;
					Assert.AreEqual<byte>((byte)picType, Marshal.ReadByte(data, pointerSize));
					editor.Add(editor.Attributes.WMPicture, picture);
				}
			}
		}
	}
}
